<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>新增或修改</title>
</head>
<body>
<form th:action="@{/book/saveAndUp}" method="post">
    <input th:if="${book!=null}" th:value="${book.getId()}" type="hidden" name="id">
    <input th:if="${num!=null}" th:value="${num}" type="hidden" name="pageNum">
    <table th:if="book!=null">
        <tr>
            <td>书名:</td>
            <td>
                <input th:value="${book!=null?book.name:''}" type="text" name="name" required>
            </td>
        </tr>
        <tr>
            <td>价格:</td>
            <td>
                <input th:value="${book!=null?book.price:''}" type="text" name="price" required>
            </td>
        </tr>
        <tr>
            <td>类别:</td>
            <td>
                <input th:value="${book!=null?book.category:''}" type="text" name="category" required>
            </td>
        </tr>
        <tr>
            <td>库存:</td>
            <td>
                <input th:value="${book!=null?book.pnum:''}" type="text" name="pnum" required>
            </td>
        </tr>
        <tr>
            <td>封面</td>
            <td>
                <input th:value="${book!=null?book.imgurl:''}" type="text" name="imgurl" required>
            </td>
        </tr>
        <tr>
            <td>简介:</td>
            <td>
                <input th:value="${book!=null?book.description:''}" type="text" name="description" required>
            </td>
        </tr>
        <tr>
            <td>作者:</td>
            <td>
                <input th:value="${book!=null?book.author:''}" type="text" name="author" required>
            </td>
        </tr>
    </table>
    <input type="submit" value="提交">
</form>

</body>
</html>